/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Database;

/**
 *
 * @author rizky
 */

import java.sql.*;

public class database {
    public static Connection conn;
    public static ResultSet result = null;
    public static Statement stmt = null;

    public database() {
        try
        {
            conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/PPL", "cinta", "cinta");
        }
        catch (SQLException e)
        {
            System.err.println(e.getMessage());
        }
    }

    public database(String dbAddressAndPort, String dbname, String username,String password) {
        try
        {
            conn = DriverManager.getConnection("jdbc:mysql://" + dbAddressAndPort +"/"+ dbname, username, password);
        }
        catch (SQLException e)
        {
            System.err.println(e.getMessage());
        }
    }
    public void setQuery(String query) throws SQLException{
        stmt = conn.createStatement();
        result = stmt.executeQuery(query);
    }
}
